//
//  LTFThirdTableViewCell.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/15.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFThirdTableViewCell.h"
#import "IsNight.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation LTFThirdTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    //图高180
    //第一张图片
    self.firstImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_firstImageView];
    //_firstImageView.backgroundColor = [UIColor redColor];
    [_firstImageView release];
    
    //第二章图片
    self.secondImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_secondImageView];
    //_secondImageView.backgroundColor = [UIColor redColor];
    [_secondImageView release];
    
    //第三张图片
    
    self.thirdImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_thirdImageView];
    //_thirdImageView.backgroundColor = [UIColor redColor];
    [_thirdImageView release];
    
    //标题
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_titleLabel];
    [_titleLabel release];
    
    //跟帖数
    self.countLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_countLabel];
    self.countLabel.textAlignment = NSTextAlignmentRight;
    self.countLabel.textColor = [UIColor grayColor];
    [_countLabel release];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    if ([IsNight nowIsNight]) {
        self.contentView.backgroundColor = [IsNight nightColor];
        _titleLabel.textColor = [IsNight textNightColor];
        _countLabel.textColor = [IsNight textNightColor];
    }
    else {
        self.contentView.backgroundColor = [UIColor whiteColor];
        _titleLabel.textColor = [UIColor blackColor];
        _countLabel.textColor = [UIColor blackColor];
    }
    self.titleLabel.frame = CGRectMake(10, 20, WIDTH - 120, 40);
    
    self.countLabel.frame = CGRectMake(WIDTH - 100, 20, 80, 30);
    self.countLabel.font = [UIFont systemFontOfSize:15];;
    self.firstImageView.frame = CGRectMake(10, 65, (WIDTH - 50) / 3, 90);
    self.secondImageView.frame = CGRectMake((WIDTH - 50) / 3 + 25, 65, (WIDTH - 50) / 3, 90);
    self.thirdImageView.frame = CGRectMake((WIDTH - 50) / 3 * 2 + 40, 65, (WIDTH - 50) / 3, 90);
}
- (void)dealloc
{
    [_firstImageView release];
    [_secondImageView release];
    [_thirdImageView release];
    [_titleLabel release];
    [_countLabel release];
    [super dealloc];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
